<template>
  <scroll-view
    scroll-y
    enhanced
    :show-scrollbar="false"
    :lower-threshold="10"
    @scrolltolower="scrolltolower"
    style="height: 100%"
  >
    <slot name="default"></slot>
  </scroll-view>
</template>

<script>
import TopInfo from "@/utils/top-info";
export default {
  name: "my-body",
  data() {
    return {
      bodyHeight: 0,
      triggerScrolltolowerWrap: this._.debounce(
        this.triggerScrolltolower,
        200,
        {
          leading: true,
        }
      ),
    };
  },
  methods: {
    triggerScrolltolower() {
      this.$emit("scrolltolower");
    },
    scrolltolower() {
      this.triggerScrolltolowerWrap();
    },
  },
  mounted() {
    // 获取剩余高度
    this.bodyHeight = TopInfo.getBodyHeight();
    console.log("剩余高度(滚动区域)", this.bodyHeight);
  },
};
</script>
